<?
/**
 * This file is part of XNAT light.
 *
 * XNAT light is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * XNAT light is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with XNAT light.  If not, see <http://www.gnu.org/licenses/>.
 */
namespace NRG\Xnat;

use NRG\Database\Mappers as Mappers;

/**
 * XNAT MR Assessor model
 *
 * @package NRG\Xnat
 */
class MrAssessor
{
    /**
     * MR Assessor ID
     *
     * @var string
     */
    protected $_id;
 
    /**
     * Assessor parent ID
     *
     * @var string
     */
    protected $_parentID;

    /**
     * Assessor parent MR Session
     *
     * @var NRG\Xnat\MrSession
     */
    protected $_parent;

    /**
     * Constructor
     */
    public function __construct()
    {
    }

    /**
     * Set assessor ID
     *
     * @param string $id
     */
    public function setID($id=null)
    {
	$this->_id = $id;
    }

    /**
     * Set parent MR Session ID
     *
     * @param string $id
     */
    public function setParentID($id=null)
    {
	$this->_parentID = $id;
    }

    /**
     * Access parent MR Session
     *
     * @return NRG\Xnat\MrSession
     */
    public function getParent()
    {
	if($this->_parent === null)
	{
	    $mapper = new Mappers\MrSession($this->_parentID);
	    $this->_parent = $mapper->getMrSession($this->_parentID);
	}

	return $this->_parent;
    }

    /**
     * Get parent project
     *
     * @return NRG\Xnat\Project
     */
    public function getProject()
    {
	if ($this->_parent === null)
	    $this->getParent();

	return $this->_parent->getProject();
    }

    /**
     * Access assessor ID
     *
     * @return string
     */
    public function getID()
    {
	return $this->_id;
    }
}